package com.infore.remoteControl.outsideInterface.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.infore.remoteControl.constant.Constants;
import com.infore.remoteControl.entity.instructionsEntity.InstructionsData;
import com.infore.remoteControl.entity.protocolEntity.ProtocolData;
import com.infore.remoteControl.enums.ResultStatus;
import com.infore.remoteControl.outsideInterface.service.IOutsideService;
import com.infore.remoteControl.repository.IInstructionDataRepository;
import com.infore.remoteControl.repository.IProtocolDataRepository;
import com.infore.remoteControl.util.ResultEntity;

@Service
public class OutsideServiceImpl implements IOutsideService {
	
	@Autowired
	IProtocolDataRepository iProtocolDataRepository;
	
	@Autowired
	IInstructionDataRepository iInstructionDataRepository;
	
	@Override
	public ResultEntity getProtocol(List<String> protocolDataIds) {
		List<ProtocolData> list = iProtocolDataRepository.findByIdIn(protocolDataIds);
		return new ResultEntity(ResultStatus.SUCCESS, Constants.QUERY_SUCCESS).setDataList(list);
	}

	@Override
	public ResultEntity getInstructions(List<String> equipmentIds) {
		List<InstructionsData> list = iInstructionDataRepository.findByEquipmentIdIn(equipmentIds);
		return new ResultEntity(ResultStatus.SUCCESS, Constants.QUERY_SUCCESS).setDataList(list);
	}
	
}
